<template>
  <div class="login_page">
    <div v-preview="store.getGetPreviewImg()" v-origin="bg"></div>
    <LoginBgMax v-if="!store.IsShowCenetr()">
      <template #login>
        <slot name="login"></slot>
      </template>
      <template #register>
        <slot name="register"></slot>
      </template>
    </LoginBgMax>

    <!-- 小屏下的login  -->
    <LoginBgMin v-if="!store.IsShowCenetr()">
      <template #login>
        <slot name="login"></slot>
      </template>
      <template #register>
        <slot name="register"></slot>
      </template>
    </LoginBgMin>

    <!-- 登录成功后显示的 -->
    <LoginCenter v-if="store.IsShowCenetr()"></LoginCenter>
  </div>
</template>

<script lang="ts" setup>
import { inject, ref, defineAsyncComponent } from 'vue'
//大屏的login引入
const LoginBgMax = defineAsyncComponent(
  () => import('@/components/login/LoginBgMax.vue')
)
// 小屏login 引入
const LoginBgMin = defineAsyncComponent(
  () => import('@/components/login/LoginBgMin.vue')
)

// 登录成功后显示的
const LoginCenter = defineAsyncComponent(
  () => import('@/components/login/LoginCenter.vue')
)
const store: any = inject('store')

const bg = ref('https://w.wallhaven.cc/full/we/wallhaven-weeqzx.jpg')

bg.value =
  store.state.frontData && store.state.BaseUrl + store.state.frontData.bg
</script>

<style lang="scss" scoped>
.login_page {
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  :deep(.v-progressive-image) {
    position: absolute;
    width: 100%;
    height: 100%;
    z-index: -1;

    .pi-origin,
    .pi-preview {
      width: 100%;
      height: 100%;
      object-fit: cover;
    }
  }
}

@media (max-width: 760px) {
  .login_page {
    display: block;
  }
}
</style>
